package competition.cig.cs478;

import ch.idsia.ai.agents.Agent;
import ch.idsia.mario.environments.Environment;

import competition.cig.cs478.backprop.Network;
import competition.cig.cs478.backprop.NetworkAdapter;

public class CS478_BackpropAgent implements Agent {
	private String name;
	private Network network;
	private NetworkAdapter networkAdapter;

	public CS478_BackpropAgent(Network network) {
        setName("CS478_BackpropAgent");
        networkAdapter = new NetworkAdapter();
        reset();
        setNetwork(network);
	}
	
	public void setNetwork(Network network) {
		this.network = network;
	}
	
	@Override
	public void reset() {
	}

	@Override
	public boolean[] getAction(Environment observation) {
		return networkAdapter.getOutput(network.update(networkAdapter.getInput(observation)));
	}

	@Override
	public AGENT_TYPE getType() {
		return AGENT_TYPE.AI;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public void setName(String name) {
		this.name = name;		
	}
}
